@model OrderDetailsModel
@using Nop.Core.Domain.Orders;
@using Nop.Web.Models.Order;
@using Nop.Services.Localization;
@{
    if (!Model.PrintMode)
    {
        Layout = "~/Views/Shared/_Layout.cshtml";
    }
    else
    {
        Layout = "~/Views/Shared/_Print.cshtml";
    }
    //title
    Html.AddTitleParts(T("PageTitle.OrderDetails").Text);
}
@if (Model.PrintMode)
{
    <script type="text/javascript">
        jQuery(document).ready(function () {
            window.print();
        });
    </script>
}
<div class="order-details-container col-xxs-12 col-xs-12 col-sm-10 col-sm-offset-1 col-md-10 col-md-offset-1 col-lg-10 col-lg-offset-1">
    <div class="col-xxs-12 col-xs-12 col-sm-12 col-md-12 col-lg-12">
        <div class="col-xxs-6 col-xs-6 col-sm-12 col-md-4 col-lg-6">
            <h2>@T("PageTitle.OrderDetails")</h2>
            <div class="order-id">
                @T("Order.Shipments.Order#")@Model.Id
            </div>
            <div class="order-date">
                Order Date: @Model.CreatedOn
            </div>
            <div class="order-status">
                Order Status: @Model.OrderStatus
            </div>

        </div>
        <div class="col-xxs-6 col-xs-6 col-sm-12 col-md-8 col-lg-6 print-download-return-button text-right">
            <button type="button" class="btn print-order-button" onclick="printPage()" target="_blank"><i class="fa fa-print"></i>&nbsp;&nbsp;@T("Order.Print")</button>

            @*<button type="button" class="btn print-order-button" onclick="setLocation('@Url.RouteUrl("PrintOrderDetails", new { orderId = Model.Id })')" target="_blank"><i class="fa fa-print"></i>&nbsp;&nbsp;@T("Order.Print")</button>*@



            @*<input type="button" value="@T("Order.Print")" onclick="setLocation('@Url.RouteUrl("PrintOrderDetails", new { orderId = Model.Id })')" target="_blank" class="btn button-grey print-order-button" />*@

            @if (Model.DisplayPdfInvoice)
            {
                <button type="button" class="btn pdf-order-button" onclick="setLocation('@Url.RouteUrl("GetOrderPdfInvoice", new { orderId = Model.Id })')"><i class="fa fa-download"></i>&nbsp;&nbsp;@T("Order.GetPDFInvoice")</button>

                @*<input type="button" value="@T("Order.GetPDFInvoice")" onclick="setLocation('@Url.RouteUrl("GetOrderPdfInvoice", new { orderId = Model.Id })')" class="btn button-grey pdf-order-button" />*@
            }
            
            @if (Model.CanCancel)
            {
                <button type="button" class="btn cancel-order-button" onclick="if(confirm('@T("ConfirmToCancel")')) setLocation('@Url.RouteUrl("CommerceCancelOrder", new { orderId = Model.Id })')"><i class="fa fa-download"></i>&nbsp;&nbsp;@T("Order.CancelOrder")</button>
            }
            
            @if (Model.CanReturn)
            {
                <button type="button" class="btn return-order-button" onclick="setLocation('@Url.RouteUrl("ReturnRequest", new { orderId = Model.Id })')"><i class="fa fa-download"></i>&nbsp;&nbsp;@T("Order.ReturnRequest")</button>
            }
            <div></div>
            <button type="button" class="btn" onclick="goBack()"><i class="fa fa-arrow-circle-o-left"></i>&nbsp;&nbsp;Return to Shopping Orders</button>


            @*<input type="button" class="btn" value="Return to Orders" onclick="setLocation('@Url.RouteUrl("CustomerOrders")')" />*@
        </div>

    </div>
    <div class="col-xxs-12 col-xs-12 col-sm-12 col-md-12 col-lg-12">
        @if (!Model.PrintMode)
        {
            if (Model.IsShippable)
            {
                <div class="col-xs-6 col-sm-4 col-md-4 col-lg-4 shipping-address-details">
                    <h3>@T("Order.ShippingAddress")</h3>
                    <div class="name">
                        <b>@Model.ShippingAddress.FirstName @Model.ShippingAddress.LastName</b>
                    </div>
                    @if (Model.ShippingAddress.CompanyEnabled && !String.IsNullOrEmpty(Model.ShippingAddress.Company))
                    {
                        <div class="company">
                            @Model.ShippingAddress.Company
                        </div>
                    }

                    @if (Model.ShippingAddress.StreetAddressEnabled)
                    {
                        <div class="address1">
                            @Model.ShippingAddress.Address1
                        </div>
                    }
                    @if (Model.ShippingAddress.StreetAddress2Enabled && !String.IsNullOrEmpty(Model.ShippingAddress.Address2))
                    {
                        <div class="address2">
                            @Model.ShippingAddress.Address2
                        </div>
                    }

                    @if (Model.ShippingAddress.CityEnabled ||
                            Model.ShippingAddress.StateProvinceEnabled ||
                            Model.ShippingAddress.ZipPostalCodeEnabled)
                    {
                        if (Model.ShippingAddress.CityEnabled)
                        {

                            @Model.ShippingAddress.City<text>, </text>

                        }
                        if (Model.ShippingAddress.StateProvinceEnabled)
                        {
                            @Model.ShippingAddress.StateProvinceName<text>, </text>

                        }
                        <br />
                        if (Model.ShippingAddress.CountryEnabled && !String.IsNullOrEmpty(Model.ShippingAddress.CountryName))
                        {
                            @Model.ShippingAddress.CountryName<text>, </text>
                        }
                    }

                    @if (Model.ShippingAddress.ZipPostalCodeEnabled)
                    {
                        @Model.ShippingAddress.ZipPostalCode
                    }
                    <div class="email">
                        @Model.ShippingAddress.Email
                    </div>
                    @if (Model.ShippingAddress.CellPhoneEnabled)
                    {
                        <div class="phone">
                            @Model.ShippingAddress.CellPhoneNumber
                        </div>
                    }
                    @if (Model.ShippingAddress.PhoneEnabled)
                    {
                        <div class="phone">
                            @Model.ShippingAddress.PhoneNumber
                        </div>
                    }
                    @if (Model.ShippingAddress.FaxEnabled)
                    {
                        <div class="fax">
                            @Model.ShippingAddress.FaxNumber
                        </div>
                    }
                    
                    
                </div>

            }

            <div class="col-xs-6 col-sm-4 col-md-4 col-lg-4 billing-address-details">
                <h3>@T("Order.BillingAddress")</h3>
                <div class="name">
                    <b>@Model.BillingAddress.FirstName @Model.BillingAddress.LastName</b>
                </div>
                @if (Model.BillingAddress.CompanyEnabled && !String.IsNullOrEmpty(Model.BillingAddress.Company))
                {
                    <div class="company">
                        @Model.BillingAddress.Company
                    </div>
                }
                @if (Model.BillingAddress.StreetAddressEnabled)
                {
                    <div class="address1">
                        @Model.BillingAddress.Address1
                    </div>
                }
                @if (Model.BillingAddress.StreetAddress2Enabled && !String.IsNullOrEmpty(Model.BillingAddress.Address2))
                {
                    <div class="address2">
                        @Model.BillingAddress.Address2
                    </div>
                }
                @if (Model.BillingAddress.CityEnabled ||
                        Model.BillingAddress.StateProvinceEnabled ||
                        Model.BillingAddress.ZipPostalCodeEnabled)
                {
                    if (Model.BillingAddress.CityEnabled)
                    {
                        @Model.BillingAddress.City<text>, </text>
                    }
                    if (Model.BillingAddress.StateProvinceEnabled)
                    {
                        @Model.BillingAddress.StateProvinceName<text>, </text>
                    }
                    <br />
                    if (Model.BillingAddress.CountryEnabled && !String.IsNullOrEmpty(Model.BillingAddress.CountryName))
                    {
                        @Model.BillingAddress.CountryName<text>, </text>
                    }
                    if (Model.BillingAddress.ZipPostalCodeEnabled)
                    {
                        @Model.BillingAddress.ZipPostalCode
                    }
                }
                <div class="email">
                    @Model.BillingAddress.Email
                </div>
                @if (Model.BillingAddress.CellPhoneEnabled)
                {
                    <div class="phone">
                        @Model.BillingAddress.CellPhoneNumber
                    </div>
                }
                @if (Model.BillingAddress.PhoneEnabled)
                {
                    <div class="phone">
                        @Model.BillingAddress.PhoneNumber
                    </div>
                }
                @if (Model.BillingAddress.FaxEnabled)
                {
                    <div class="fax">
                        @Model.BillingAddress.FaxNumber
                    </div>
                }
                <div class="payment-information">
                    <h3>Payment Method</h3>
                    <p>@Model.PaymentMethod</p>
                    
                </div>

                @if (!String.IsNullOrEmpty(Model.VatNumber))
                {
                    <div class="vat">
                        <div class="vat-label">
                            <b>@T("Order.VATNumber")</b>
                        </div>
                        <div class="vat-value">
                            @Model.VatNumber
                        </div>
                    </div>
                }

                @if (Model.DisplayPurchaseOrderNumber)
                {
                    <div class="po">
                        <div class="po-label">
                            <b>@T("Order.PurchaseOrderNumber")</b>
                        </div>
                        <div class="po-value">
                            @Model.PurchaseOrderNumber
                        </div>
                    </div>
                }
            </div>

            <div class="col-xs-12 col-sm-4 col-md-4 col-lg-4 order-total-details">

                <table class="cart-total table order-details-table">
                    <thead>
                        <tr>
                            <th><h3>@T("Order.OrderTotal")</h3></th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td class="cart-total-left">
                                @T("Order.SubTotal"):
                            </td>
                            <td class="cart-total-right">
                                <span class="nobr">
                                    @Model.OrderSubtotal
                                </span>
                            </td>
                        </tr>
                        @if (!string.IsNullOrEmpty(Model.OrderSubTotalDiscount))
                        {
                            <tr>
                                <td class="cart-total-left">
                                    @T("Order.SubTotalDiscount"):
                                </td>
                                <td class="cart-total-right">
                                    <span class="nobr">
                                        @Model.OrderSubTotalDiscount
                                    </span>
                                </td>
                            </tr>
                        }
                        @if (Model.IsShippable)
                        {
                            <tr>
                                <td class="cart-total-left">
                                    @T("Order.Shipping"):
                                </td>
                                <td class="cart-total-right">
                                    <span class="nobr">
                                        @Model.OrderShipping
                                    </span>
                                </td>
                            </tr>
                        }
                        @if (!string.IsNullOrEmpty(Model.PaymentMethodAdditionalFee))
                        {
                            <tr>
                                <td class="cart-total-left">
                                    @T("Order.PaymentMethodAdditionalFee"):
                                </td>
                                <td class="cart-total-right">
                                    <span class="nobr">
                                        @Model.PaymentMethodAdditionalFee
                                    </span>
                                </td>
                            </tr>
                        }
                        @if (Model.DisplayTaxRates && Model.TaxRates.Count > 0)
                        {
                            foreach (var taxRate in Model.TaxRates)
                            {
                                <tr>
                                    <td class="cart-total-left">
                                        @string.Format(T("Order.TaxRateLine").Text, taxRate.Rate):
                                    </td>
                                    <td class="cart-total-right">
                                        <span class="nobr">
                                            @taxRate.Value
                                        </span>
                                    </td>
                                </tr>
                            }
                        }

                        @if (Model.DisplayTax)
                        {
                            <tr>
                                <td class="cart-total-left">
                                    @T("Order.Tax"):
                                </td>
                                <td class="cart-total-right">
                                    <span class="nobr">
                                        @Model.Tax
                                    </span>
                                </td>
                            </tr>
                        }
                        @if (!string.IsNullOrEmpty(Model.OrderTotalDiscount))
                        {
                            <tr>
                                <td class="cart-total-left">
                                    @T("Order.TotalDiscount"):
                                </td>
                                <td class="cart-total-right">
                                    <span class="nobr">
                                        @Model.OrderTotalDiscount
                                    </span>
                                </td>
                            </tr>
                        }
                        @if (Model.GiftCards.Count > 0)
                        {
                            foreach (var gc in Model.GiftCards)
                            {
                                <tr>
                                    <td class="cart-total-left">
                                        @string.Format(T("Order.GiftCardInfo").Text, gc.CouponCode):
                                    </td>
                                    <td class="cart-total-right">
                                        <span class="nobr">
                                            @gc.Amount
                                        </span>
                                    </td>
                                </tr>
                            }
                        }
                        @if (Model.RedeemedRewardPoints > 0)
                        {
                            <tr>
                                <td class="cart-total-left">
                                    @string.Format(T("Order.RewardPoints").Text, Model.RedeemedRewardPoints):
                                </td>
                                <td class="cart-total-right">
                                    <span class="nobr">
                                        @Model.RedeemedRewardPointsAmount
                                    </span>
                                </td>
                            </tr>
                        }
                        <tr>
                            <td class="cart-total-left">
                                <b>
                                    @T("Order.OrderTotal"):
                                </b>
                            </td>
                            <td class="cart-total-right">
                                <span class="nobr">
                                    <b>
                                        @Model.OrderTotal
                                    </b>
                                </span>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        }
    
    </div>
    <div class=" col-xxs-12 col-xs-12 col-sm-12 col-md-12 col-lg-12">
        <div class=" col-xxs-12 col-xs-12 col-sm-12 col-md-12 col-lg-12 questions-concerns text-right">
            <h4>Questions or issues with your order?</h4>
            <a href="/contactus" class=" btn btn-info"><i class="fa fa-envelope"></i>&nbsp;&nbsp; Email us</a>
            <button type="button" class="btn btn-info"><i class="fa fa-phone"></i>&nbsp;&nbsp; Call us at 604-290-9888</button>
        </div>
        </div>
        <div class="clear"></div>
        @if (!Model.PrintMode)
        {
            @*<h2>Prod</h2>*@
        }
        @Html.Widget("orderdetails_page_top")

        @Html.Widget("orderdetails_page_beforeproducts")

        @if (Model.PrintMode)
        {
            <div id="order-detail-print">
                <div id="sh-header-logo">
                    <img src="/subsites/commerce/Themes/SpotsHUB/Content/images/spotshub-textlogo.png">
                </div>
                <div id="order-number">
                    @T("Order.Order#")@Model.Id
                </div>
                <div id="order-date">
                    @T("Order.OrderDate"): @Model.CreatedOn.ToString("F")
                </div>

                @if (Model.IsShippable)
                {

                    <div class="shippinginfo">
                        <h3>@T("Order.ShippingAddress")</h3>
                        <div class="name">
                            <b>@Model.ShippingAddress.FirstName @Model.ShippingAddress.LastName</b>
                        </div>
                        <div class="email">
                            @T("Order.Email"): @Model.ShippingAddress.Email
                        </div>
                        @if (Model.ShippingAddress.PhoneEnabled)
                        {
                            <div class="phone">
                                @T("Order.Phone"): @Model.ShippingAddress.PhoneNumber
                            </div>
                        }
                        @if (Model.ShippingAddress.FaxEnabled)
                        {
                            <div class="fax">
                                @T("Order.Fax"): @Model.ShippingAddress.FaxNumber
                            </div>
                        }
                        @if (Model.ShippingAddress.CompanyEnabled && !String.IsNullOrEmpty(Model.ShippingAddress.Company))
                        {
                            <div class="company">
                                @Model.ShippingAddress.Company
                            </div>
                        }
                        @if (Model.ShippingAddress.StreetAddressEnabled)
                        {
                            <div class="address1">
                                @Model.ShippingAddress.Address1
                            </div>
                        }
                        @if (Model.ShippingAddress.StreetAddress2Enabled && !String.IsNullOrEmpty(Model.ShippingAddress.Address2))
                        {
                            <div class="address2">
                                @Model.ShippingAddress.Address2
                            </div>
                        }
                        @if (Model.ShippingAddress.CityEnabled ||
                                    Model.ShippingAddress.StateProvinceEnabled ||
                                    Model.ShippingAddress.ZipPostalCodeEnabled)
                        {
                            <div class="city-state-zip">
                                @if (Model.ShippingAddress.CityEnabled)
                                {
                                    @Model.ShippingAddress.City<text>,</text>
                                }
                                @if (Model.ShippingAddress.StateProvinceEnabled)
                                {
                                    @Model.ShippingAddress.StateProvinceName
                                }
                                @if (Model.ShippingAddress.ZipPostalCodeEnabled)
                                {
                                    @Model.ShippingAddress.ZipPostalCode
                                }
                            </div>
                        }
                        @if (Model.ShippingAddress.CountryEnabled && !String.IsNullOrEmpty(Model.ShippingAddress.CountryName))
                        {
                            <div class="country">
                                @Model.ShippingAddress.CountryName
                            </div>
                        }
                    </div>

                }

                <div class="billinginfo">
                    <h3>@T("Order.BillingAddress")</h3>
                    <div class="name">
                        <b>@Model.BillingAddress.FirstName @Model.BillingAddress.LastName</b>
                    </div>
                    <div class="email">
                        @Model.BillingAddress.Email
                    </div>
                    @if (Model.BillingAddress.PhoneEnabled)
                    {
                        <div class="phone">
                            @Model.BillingAddress.PhoneNumber
                        </div>
                    }
                    @if (Model.BillingAddress.FaxEnabled)
                    {
                        <div class="fax">
                            @Model.BillingAddress.FaxNumber
                        </div>
                    }
                    @if (Model.BillingAddress.CompanyEnabled && !String.IsNullOrEmpty(Model.BillingAddress.Company))
                    {
                        <div class="company">
                            @Model.BillingAddress.Company
                        </div>
                    }
                    @if (Model.BillingAddress.StreetAddressEnabled)
                    {
                        <div class="address1">
                            @Model.BillingAddress.Address1
                        </div>
                    }
                    @if (Model.BillingAddress.StreetAddress2Enabled && !String.IsNullOrEmpty(Model.BillingAddress.Address2))
                    {
                        <div class="address2">
                            @Model.BillingAddress.Address2
                        </div>
                    }
                    @if (Model.BillingAddress.CityEnabled ||
                                Model.BillingAddress.StateProvinceEnabled ||
                                Model.BillingAddress.ZipPostalCodeEnabled)
                    {
                        <div class="city-state-zip">
                            @if (Model.BillingAddress.CityEnabled)
                            {
                                @Model.BillingAddress.City<text>,</text>
                            }
                            @if (Model.BillingAddress.StateProvinceEnabled)
                            {
                                @Model.BillingAddress.StateProvinceName
                            }
                            @if (Model.BillingAddress.ZipPostalCodeEnabled)
                            {
                                @Model.BillingAddress.ZipPostalCode
                            }
                        </div>
                    }
                    @if (Model.BillingAddress.CountryEnabled && !String.IsNullOrEmpty(Model.BillingAddress.CountryName))
                    {
                        <div class="country">
                            @Model.BillingAddress.CountryName
                        </div>
                    }
                    @if (!String.IsNullOrEmpty(Model.VatNumber))
                    {
                        <div class="vat">
                            <div class="vat-label">
                                <b>@T("Order.VATNumber")</b>
                            </div>
                            <div class="vat-value">
                                @Model.VatNumber
                            </div>
                        </div>
                    }

                    @if (Model.DisplayPurchaseOrderNumber)
                    {
                        <div class="po">
                            <div class="po-label">
                                <b>@T("Order.PurchaseOrderNumber")</b>
                            </div>
                            <div class="po-value">
                                @Model.PurchaseOrderNumber
                            </div>
                        </div>
                    }
                </div>

                <div class="clear"></div>
            </div>
        }

        @if (Model.Items.Count > 0)
        {
            <div class="products-box-print col-xxs-12 col-xs-12 col-sm-12 col-md-12 col-lg-12">
                <div class="col-xxs-12 col-xs-12 col-sm-12 col-md-12 col-lg-12">
                    <h3>Product(s) Ordered:</h3>
                </div>
                @foreach (var item in Model.Items)
                {
                    <div class="cart-store-item col-xxs-12 col-xs-12 col-sm-12 col-md-12 col-lg-12">

                        <div class="cart-store-items-image col-xs-3 col-sm-3 col-md-3 col-lg-3">
                            <div class="cart-store-item-image">
                                @if (!Model.PrintMode)
                                {
                                    <a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })" title="View details"><img alt="@item.PictureModel.AlternateText" src="@item.PictureModel.ImageUrl" title="@item.PictureModel.Title" class="img-responsive" /></a>
                                }
                                else
                                {
                                    <img alt="@item.PictureModel.AlternateText" src="@item.PictureModel.ImageUrl" title="@item.PictureModel.Title" />
                                }
                            </div>
                        </div>
                        <div class="cart-store-item-productname col-xxs-4 col-xs-3 col-sm-3 col-md-3 col-lg-3">
                            <div class="cart-store-item-name">
                                @if (!Model.PrintMode)
                                {
                                    <a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })" title="View details"><h4>@item.ProductName</h4></a>
                                }
                                else
                                {
                                    <h4>@item.ProductName</h4>
                                }
                            </div>
                            @if (Model.ShowSku)
                            {
                                @item.Sku
                            }


                            @if (!String.IsNullOrEmpty(item.AttributeInfo))
                            {
                                <div class="attributes">
                                    @Html.Raw(item.AttributeInfo)
                                </div>
                            }
                        </div>
                        <div class="cart-page-qty col-xxs-1 col-xs-3 col-sm-3 col-md-3 col-lg-3 text-center">
                            <b>Quantity</b><br />
                            <span>@item.Quantity</span>
                        </div>
                        <div class="cart-page-total col-xxs-1 col-xs-3 col-sm-3 col-md-3 col-lg-3">
                            <b>Subtotal</b><br />
                            <span class="product-subtotal">@item.SubTotal</span>
                        </div>


                    </div>
                }


                @if (!String.IsNullOrEmpty(Model.CheckoutAttributeInfo))
                {
                    <div class="checkout-attributes">
                        @Html.Raw(Model.CheckoutAttributeInfo)
                    </div>

                }
            </div>

            <div class="buttons col-xs-12 col-sm-12 col-md-12 col-lg-12">
                @if (!Model.PrintMode)
                {

                    @*@if (Model.IsReOrderAllowed)
                        {
                        <input type="button" value="@T(" order.reorder")" class="button-1 re-order-button" onclick="setLocation('@Url.RouteUrl(" reorder", new { orderid=Model.Id }) ')"  />
                        }*@
                    if (Model.CanReturn)
                    {
                        <input type="button" value="@T("Order.ReturnItems")" class="button-grey return-items-button" onclick="setLocation('@Url.RouteUrl("ReturnRequest", new { orderid=Model.Id }) ')" />
                    }

                }
            </div>

        }

        @if (Model.PrintMode)
        {
            <div id="order-detail-total">
                <table class="cart-total">
                    <tbody>
                        <tr>
                            <td class="cart-total-left">
                                @T("Order.SubTotal"):
                            </td>
                            <td class="cart-total-right">
                                <span class="nobr">
                                    @Model.OrderSubtotal
                                </span>
                            </td>
                        </tr>
                        @if (!string.IsNullOrEmpty(Model.OrderSubTotalDiscount))
                        {
                            <tr>
                                <td class="cart-total-left">
                                    @T("Order.SubTotalDiscount"):
                                </td>
                                <td class="cart-total-right">
                                    <span class="nobr">
                                        @Model.OrderSubTotalDiscount
                                    </span>
                                </td>
                            </tr>
                        }
                        @if (Model.IsShippable)
                        {
                            <tr>
                                <td class="cart-total-left">
                                    @T("Order.Shipping"):
                                </td>
                                <td class="cart-total-right">
                                    <span class="nobr">
                                        @Model.OrderShipping
                                    </span>
                                </td>
                            </tr>
                        }
                        @if (!string.IsNullOrEmpty(Model.PaymentMethodAdditionalFee))
                        {
                            <tr>
                                <td class="cart-total-left">
                                    @T("Order.PaymentMethodAdditionalFee"):
                                </td>
                                <td class="cart-total-right">
                                    <span class="nobr">
                                        @Model.PaymentMethodAdditionalFee
                                    </span>
                                </td>
                            </tr>
                        }
                        @if (Model.DisplayTaxRates && Model.TaxRates.Count > 0)
                        {
                            foreach (var taxRate in Model.TaxRates)
                            {
                                <tr>
                                    <td class="cart-total-left">
                                        @string.Format(T("Order.TaxRateLine").Text, taxRate.Rate):
                                    </td>
                                    <td class="cart-total-right">
                                        <span class="nobr">
                                            @taxRate.Value
                                        </span>
                                    </td>
                                </tr>
                            }
                        }
                        @if (Model.DisplayTax)
                        {
                            <tr>
                                <td class="cart-total-left">
                                    @T("Order.Tax"):
                                </td>
                                <td class="cart-total-right">
                                    <span class="nobr">
                                        @Model.Tax
                                    </span>
                                </td>
                            </tr>
                        }
                        @if (!string.IsNullOrEmpty(Model.OrderTotalDiscount))
                        {
                            <tr>
                                <td class="cart-total-left">
                                    @T("Order.TotalDiscount"):
                                </td>
                                <td class="cart-total-right">
                                    <span class="nobr">
                                        @Model.OrderTotalDiscount
                                    </span>
                                </td>
                            </tr>
                        }
                        @if (Model.GiftCards.Count > 0)
                        {
                            foreach (var gc in Model.GiftCards)
                            {
                                <tr>
                                    <td class="cart-total-left">
                                        @string.Format(T("Order.GiftCardInfo").Text, gc.CouponCode):
                                    </td>
                                    <td class="cart-total-right">
                                        <span class="nobr">
                                            @gc.Amount
                                        </span>
                                    </td>
                                </tr>
                            }
                        }
                        @if (Model.RedeemedRewardPoints > 0)
                        {
                            <tr>
                                <td class="cart-total-left">
                                    string.Format(T("Order.RewardPoints").Text, Model.RedeemedRewardPoints):
                                </td>
                                <td class="cart-total-right">
                                    <span class="nobr">
                                        @Model.RedeemedRewardPointsAmount
                                    </span>
                                </td>
                            </tr>
                        }
                        <tr>
                            <td class="cart-total-left">
                                <b>
                                    @T("Order.OrderTotal"):
                                </b>
                            </td>
                            <td class="cart-total-right">
                                <span class="nobr">
                                    <b>
                                        @Model.OrderTotal
                                    </b>
                                </span>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        }
        @Html.Widget("orderdetails_page_afterproducts")
        <div class="col-xxs-12 col-xs-12 col-sm-12 col-md-12 col-lg-12">
            @if (!Model.PrintMode)
            {
                if (Model.Shipments.Count > 0)
                {
                    <div class="col-xxs-12 col-xs-12 col-sm-12 col-md-12 col-lg-12">
                        <h3>@T("Order.Shipments")</h3>
                    </div>
                    <div class="clear">
                    </div>
                    <div class="shipments-box col-xxs-12 col-sm-12 col-md-12 col-lg-12">
                        <table class="data-table table">

                            <thead>
                                <tr>
                                    <th class="a-center">
                                        @T("Order.Shipments.ID")
                                    </th>
                                    <th class="a-center">
                                        @T("Order.Shipments.TrackingNumber")
                                    </th>
                                    <th class="a-center">
                                        @T("Order.Shipments.ShippedDate")
                                    </th>
                                    <th class="a-center">
                                        @T("Order.Shipments.DeliveryDate")
                                    </th>
                                    <th class="a-center">
                                        @T("Order.Shipments.ViewDetails")
                                    </th>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach (var item in Model.Shipments)
                                {
                                    <tr>
                                        <td class="a-left">
                                            @item.Id.ToString()
                                        </td>
                                        <td class="a-left">
                                            @item.TrackingNumber
                                        </td>
                                        <td class="a-left">
                                            @if (item.ShippedDate.HasValue)
                                            {
                                                @item.ShippedDate.Value.ToString("D")
                                            }
                                            else
                                            {
                                                @T("Order.Shipments.ShippedDate.NotYet")
                                            }
                                        </td>
                                        <td class="a-left">
                                            @if (item.DeliveryDate.HasValue)
                                            {
                                                @item.DeliveryDate.Value.ToString("D")
                                            }
                                            else
                                            {
                                                @T("Order.Shipments.DeliveryDate.NotYet")
                                            }
                                        </td>
                                        <td class="a-center">
                                            <a href="@Url.RouteUrl("ShipmentDetails", new { shipmentId = item.Id })" title="@T("Order.Shipments.ViewDetails")">@T("Order.Shipments.ViewDetails")</a>
                                        </td>
                                    </tr>
                                }
                            </tbody>
                        </table>
                    </div>
                }
            }
        </div>
        <div class="clear">
        </div>
        @if (!Model.PrintMode)
        {
            if (Model.OrderNotes.Count > 0)
            {
                <div class="section-title">
                    @T("Order.Notes")
                </div>
                <div class="clear">
                </div>
                <div class="ordernotes-box">
                    <table class="data-table">

                        <thead>
                            <tr>
                                <th class="a-center">
                                    @T("Order.Notes.CreatedOn")
                                </th>
                                <th class="a-center">
                                    @T("Order.Notes.Note")
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach (var item in Model.OrderNotes)
                            {
                                <tr>
                                    <td class="a-left">
                                        @item.CreatedOn.ToString()
                                    </td>
                                    <td class="a-left">
                                        @Html.Raw(item.Note)
                                    </td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
            }
        }
        @*@Html.Widget("orderdetails_page_bottom")
            @if (!Model.PrintMode)
            {
                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                    <input type="button" value="@T("Order.Print")" onclick="setLocation('@Url.RouteUrl("PrintOrderDetails", new { orderId = Model.Id })')" target="_blank" class="btn button-grey print-order-button" />
                    @if (Model.DisplayPdfInvoice)
                    {
                        <input type="button" value="@T("Order.GetPDFInvoice")" onclick="setLocation('@Url.RouteUrl("GetOrderPdfInvoice", new { orderId = Model.Id })')" class="btn button-grey pdf-order-button" />
                    }

                    <input type="button" class="btn" value="Return to Orders" onclick="setLocation('@Url.RouteUrl("CustomerOrders")')" />
                </div>
            }*@
    </div>
<div class="clear"></div>

<script>
    function goBack() {
        window.history.back();
    }

    function printPage() {
        window.print();
    }
</script>
